package demon2;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class Cards {
    public static final String[] suits={"♥","♠","♣","♦"};
    List<Card> list=new ArrayList<>();
    public List<Card> buyCard(){
        for (int i = 0; i < 4; i++) {
            for (int j = 1; j < 14; j++) {
                int num=j;
                String suit=suits[i];
                Card card=new Card(num,suit);
                list.add(card);
            }
        }
        return list;
    }
    public void xipai(List<Card> list){
        Random random=new Random();
        for (int i = list.size(); i >0 ; i--) {
            int j= random.nextInt(i);
            swap(list,i,j);
        }
    }
    public void swap(List<Card>list,int i,int j){
        Card temp=list.get(i);
        list.set(i,list.get(j));
        list.set(j,temp);

    }
}
